<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            position: absolute;
            inset: 0;
            width: 10px;
            height: 10px;
            background-color: red;
        }
    </style>
</head>

<body>
    <input type="text" id="text-input" />
    <div></div>
    <script>
        const input = document.getElementById('text-input');
        input.addEventListener("paste", function (e) {
            e.preventDefault();
            alert("禁止粘贴内容！");
        });
    </script>
</body>

</html>